﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyCommunity.Models.EventListViewModel<EventViewModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Index</h2>
<% if (Model.isAdmin == true) %>
    <% { %>
<p>
    <%: Html.ActionLink("Neuen Termin erstellen", "Create") %>
</p>
<p>
    <% using  (Html.BeginForm()) {%>
    
    Suche: <%: Html.TextBox("searchString") %>
    <input type= "submit" value ="Suche" />

     <% } %>
</p>


    <% } %>
<table>
    <tr>
        <th></th>
        <th>
            Titel
        </th>
        <th>
            Beschreibung
        </th>
        <th>
            Addresse
        </th>
        <th>
            PLZ
        </th>
        <th>
            Stadt
        </th>
        <th>
            Beginn
        </th>
        <th>
            Ende
        </th>
    </tr>

<% foreach (var item in Model.events) { %>
    <tr>
        <td>
        <% if (Model.isAdmin == true) %>
        <% { %>
            <%: Html.ActionLink("Bearbeiten", "Edit", new { id=item.Id }) %> |
        <% } %>
            <%: Html.ActionLink("Details", "Details", new { id=item.Id }) %> 
        </td>
        <td>
            <%: item.Title %>
        </td>
        <td>
            <%: item.Description %>
        </td>
        <td>
            <%: item.Addresse %>
        </td>
        <td>
            <%: item.ZipCode %>
        </td>
        <td>
            <%: item.City %>
        </td>
        <td>
            <%: String.Format("{0:g}", item.StartDate) %>
        </td>
        <td>
            <%: String.Format("{0:g}", item.EndDate) %>
        </td>
    </tr>  
<% } %>

</table>

</asp:Content>

